package com.集合.Collection___.List_;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@SuppressWarnings("all")
public class ListExercise01 {
    public static void main(String[] args) {
        List list = new ArrayList();
        for (int i = 0; i < 10; i++) {
            list.add("hello"+i);
        }
        System.out.println("list = "+list);

        list.add(2,"韩顺平");
        System.out.println("2处插入元素后  list = "+list);
        System.out.println("取出 5 处 的元素"+list.get(5));
        list.remove(6);
        System.out.println("删除6处元素后  list = "+list);
        list.set(7,"pppp");
        System.out.println("替换7处元素后  list = "+list);

        Iterator it = list.iterator();
        while(it.hasNext()){
            System.out.println(it.next());
        }
    }
}
